package ext.tianma.part.imported;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;

import ext.com.core.CoreUtil;
import ext.tianma.bom.eco.BOMHelp;
import ext.tianma.part.MyPartUtil;
import wt.fc.ObjectReference;
import wt.fc.PersistenceHelper;
import wt.fc.PersistenceServerHelper;
import wt.fc.QueryResult;
import wt.fc.collections.WTCollection;
import wt.method.RemoteAccess;
import wt.part.QuantityUnit;
import wt.part.SubstituteQuantity;
import wt.part.WTPart;
import wt.part.WTPartHelper;
import wt.part.WTPartMaster;
import wt.part.WTPartSubstituteLink;
import wt.part.WTPartUsageLink;
import wt.query.QuerySpec;
import wt.session.SessionServerHelper;
import wt.util.WTException;
import wt.util.WTPropertyVetoException;
import wt.vc.config.ConfigException;
import wt.vc.views.View;
import wt.vc.views.ViewHelper;
import wt.vc.wip.WorkInProgressHelper;

public class ImportSubstituteLink implements RemoteAccess {
	private static final String CLASSNAME = CusImportSubstituteLink.class.getName();

	/**
	 * 导入替代料入口
	 * 
	 * @param excelFile
	 *            excel存放路径（绝对路径）
	 */
	public static void importSubstituteLink(String excelFile) {
		StringBuffer subBuffer = new StringBuffer();

		Sheet sheet = ImportedExcelUtil.getFirstSheet(excelFile);
		if (sheet != null) {

			try {
				importSubstituteLink(sheet, subBuffer);
			} catch (WTException e) {
				e.printStackTrace();
			} catch (WTPropertyVetoException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
	}

	public static void importSubstituteLink(Sheet sheet, StringBuffer subBuffer)
			throws WTException, WTPropertyVetoException {
		// 获取excel表的表头
		Map<Integer, String> header = getHeader(sheet);
		List<String> partInfos = new ArrayList<String>();
		// 存放需要检入的零部件
		List<WTPart> checkInPartList = new ArrayList<WTPart>();
		Set<WTPart> errorPartList = new HashSet<WTPart>();
		Iterator<Row> rowIterator = sheet.rowIterator();
		// 付权限
		boolean flag = SessionServerHelper.manager.setAccessEnforced(false);
		try {
			while (rowIterator.hasNext()) {
				Row row = rowIterator.next();

				if (row != null) {
					int rowNumber = row.getRowNum();
					if (rowNumber > ImportConstants.SUBSTITUTE_LINK_HEADER_ROW_INDEX) {
						importSubstituteLink(row, header, subBuffer, checkInPartList, errorPartList, partInfos);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			for (WTPart wTPart : errorPartList) {
				WorkInProgressHelper.service.undoCheckout(wTPart);
			}
			checkInPartList(checkInPartList);
			SessionServerHelper.manager.setAccessEnforced(flag);
		}

	}

	/**
	 * 检入已检出的零部件
	 * 
	 * @param checkInPartList
	 */
	public static void checkInPartList(List<WTPart> checkInPartList) {

		if (checkInPartList == null || checkInPartList.size() == 0) {
			return;
		}

		Iterator<WTPart> checkInIterator = checkInPartList.iterator();
		while (checkInIterator.hasNext()) {
			WTPart part = checkInIterator.next();

			if (part != null) {
				try {
					CoreUtil.checkinObject(part, "导入替代料结构完成后，检入零部件。");
				} catch (WTException e) {
					e.printStackTrace();
				}
			}
		}
	}

	private static void importSubstituteLink(Row row, Map<Integer, String> header, StringBuffer subBuffer,
			List<WTPart> checkInPartList, Set<WTPart> errorPartList, List<String> partInfos) throws Exception {
		String parentNumber = "";
		// String parentRersion = "";
		String parentView = "";
		String childNumber = "";
		// 特定替代料编号
		String substituteNumber = "";
		String quantity = "";
		// String unit = "";
		WTPart parentPart = null;
		WTPartMaster parentPartMaster = null;
		WTPartMaster childPartMaster = null;
		WTPartMaster substituteMaster = null;
		List<WTPartUsageLink> usageLinkList = new ArrayList<WTPartUsageLink>();
		int rowNumber = 0;
		try {
			Iterator<Cell> cellIterator = row.cellIterator();
			while (cellIterator.hasNext()) {
				Cell cell = cellIterator.next();
				rowNumber = cell.getRow().getRowNum() + 1;
				if (cell != null) {
					int columnIndex = cell.getColumnIndex();
					String head = header.get(columnIndex);
					if (head == null || head.trim().isEmpty()) {
						continue;
					}
					if (head.equals("Parent")) {
						parentNumber = ImportedExcelUtil.getCellValueAsString(cell, true).trim();
					} else if (head.equals("View")) {
						parentView = ImportedExcelUtil.getCellValueAsString(cell).trim();
					} else if (head.equals("Child")) {
						childNumber = ImportedExcelUtil.getCellValueAsString(cell, true).trim();
					} else if (head.equals("Substitute")) {
						substituteNumber = ImportedExcelUtil.getCellValueAsString(cell, true).trim();
					} else if (head.equals("Quantity")) {
						quantity = ImportedExcelUtil.getCellValueAsString(cell).trim();
					}
				}
			}

			String partInfo = parentNumber + substituteNumber + parentView + childNumber;

			if (StringUtils.isEmpty(parentNumber)) {// Parent
				subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Parent 字段为空,该料不可替换！</li>");
			} else {
				// 根据编号获取childPartMaster
				parentPartMaster = MyPartUtil.getWTPartMasterByNumber(parentNumber);
				if (parentPartMaster == null) {
					subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + parentNumber + "父物料不存在,该料不可替换！</li>");
				}
			}

			if (StringUtils.isEmpty(parentView)) {// View
				subBuffer = subBuffer.append("<li>第" + rowNumber + "行,View 字段为空,该料不可替换！</li>");
			} else {
				// 视图转大写
				parentView = parentView.toUpperCase();
				View viewObj = null;
				try {
					viewObj = ViewHelper.service.getView(parentView);
				} catch (WTException e) {
					// TODO: handle exception
				}
				if (viewObj == null) {
					subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + parentView + "视图不存在,该料不可替换！</li>");
				}
			}

			if (StringUtils.isEmpty(childNumber)) {// Child
				subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Child 字段为空,该料不可替换！</li>");
			} else {
				// 根据编号获取childPartMaster
				childPartMaster = MyPartUtil.getWTPartMasterByNumber(childNumber);
				if (childPartMaster == null) {
					subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + childNumber + "子物料不存在,该料不可替换！</li>");
				}
			}

			if (StringUtils.isEmpty(substituteNumber)) {// Substitute
				subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Substitute 字段为空,该料不可替换！</li>");
			} else {
				// 根据编号获取替代料Master
				substituteMaster = MyPartUtil.getWTPartMasterByNumber(substituteNumber);
				if (substituteMaster == null) {
					subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + substituteNumber + "替代料不存在,该料不可替换！</li>");
				}
			}

			boolean flag = true;// 判断用量是否为异常
			if (StringUtils.isEmpty(quantity)) {
				subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Quantity 字段为空,该料不可替换！</li>");
				flag = false;
			} else {
				String regx = "^((-?\\d+.?\\d*)[Ee]{1}(-?\\d+))$";// 判断是否科学计数法正则表达式
				Pattern pattern = Pattern.compile(regx);
				// System.out.println("===bd1:" + quantity + "==:" +
				// pattern.matcher(quantity).matches());
				if (pattern.matcher(quantity).matches()) {
					try {
						BigDecimal bd1 = new BigDecimal(quantity);
						quantity = bd1.toPlainString();
						// System.out.println("===bd1:" + bd1.toPlainString());
					} catch (Exception e) {
						subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Quantity 字段不符合格式,后台转换异常,该料不可替换！<li>");
						flag = false;
					}
				}

				if (flag) {
					String regEx = "[+]{0,1}(\\d+)$|^[+]{0,1}(\\d+\\.\\d+)$";
					boolean rs = quantity.matches(regEx);
					if (!rs) {
						subBuffer = subBuffer.append("<li>第" + rowNumber + "行,Quantity 字段只能为正数(包括小数),该料不可替换！</li>");
						flag = false;
					}
				}
			}

			// 视图下父物料
			if (StringUtils.isNotEmpty(parentNumber) && StringUtils.isNotEmpty(parentView)) {
				if (parentPartMaster != null) {
					parentPart = BOMHelp.getPart(parentNumber, "", parentView);
					if (parentPart == null) {
						subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + parentView + "视图下的" + parentNumber
								+ "父物料不存在,该料不可替换！</li>");
					}
				}

			}

			// 视图下替代料
			if (StringUtils.isNotEmpty(substituteNumber) && StringUtils.isNotEmpty(parentView)) {
				if (substituteMaster != null) {
					// 根据编号视图获取替代料 如果没有 则抛出
					WTPart masterPart = BOMHelp.getPart(substituteNumber, "", parentView);
					if (masterPart == null) {
						subBuffer = subBuffer.append("<li>第" + rowNumber + "行," + substituteNumber + "替代料在视图"
								+ parentView + "中不存在,该料不可替换！</li>");
					}
				}
			}

			// 关系是否存在
			if (parentPart != null && childPartMaster != null) {
				// 检出父件
				parentPart = (WTPart) CoreUtil.checkoutObject(parentPart);
				// 添加到列表中
				if (!checkInPartList.contains(parentPart)) {
					checkInPartList.add(parentPart);
				}
				// 获取父件与子件的所有的关联关系
				usageLinkList = getWTPartUsageLink(parentPart, childPartMaster);
				if (usageLinkList.size() == 0) {
					subBuffer = subBuffer.append(
							"<li>第" + rowNumber + "行,父物料" + parentNumber + "下不存在子物料" + childNumber + ",该料不可替换！</li>");
				}
			}

			if (parentPart != null && childPartMaster != null && substituteMaster != null && flag == true
					&& usageLinkList.size() != 0) {
				// 校验是否数据重复
				if ((!partInfos.contains(partInfo)) || (partInfos.contains(partInfo) && ("H10").equals(parentView))) {//
					// 构建单位数量对象（SubstituteQuantity）
					double sbustitueQuantity = Double.parseDouble(quantity);
					QuantityUnit qu = null;
					if (childPartMaster != null) {
						qu = childPartMaster.getDefaultUnit();
					}
					SubstituteQuantity subQuantity = SubstituteQuantity.newSubstituteQuantity(sbustitueQuantity, qu);
					String error = ceateSubstituteLink(usageLinkList, substituteMaster, subQuantity);
					partInfos.add(partInfo);
					if (!"".equals(error)) {
						subBuffer = subBuffer.append("<li>第" + rowNumber + "行,父物料" + parentNumber + "下的子物料"
								+ childNumber + error + ",该料不可替换！</li>");
					}
				} else {
					subBuffer = subBuffer.append("<li>第" + rowNumber + "行,该料重复，不可替换！</li>");
				}
			} else {
				if (parentPart != null) {
					errorPartList.add(parentPart);
				}
			}
		} catch (WTException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 重新对取得的关系排序，按照行号排序
	 * 
	 * @param usageLinkList
	 * @return
	 */
	@SuppressWarnings("unused")
	private static List<WTPartUsageLink> SortUsageLink(List<WTPartUsageLink> usageLinkList) {
		WTPartUsageLink[] usageLinkLists = new WTPartUsageLink[usageLinkList.size()];
		usageLinkList.toArray(usageLinkLists);
		for (int i = 0; i < usageLinkLists.length - 1; i++) {
			for (int j = 0; j < usageLinkLists.length - 1 - i; j++) {
				int beginSort = Integer.parseInt(usageLinkLists[j].getLineNumber().toString());
				int endSort = Integer.parseInt(usageLinkLists[j + 1].getLineNumber().toString());
				if (beginSort > endSort) {
					WTPartUsageLink tempUsageLink = usageLinkLists[j];
					usageLinkLists[j] = usageLinkLists[j + 1];
					usageLinkLists[j + 1] = tempUsageLink;
				}
			}
		}
		usageLinkList = java.util.Arrays.asList(usageLinkLists);
		return usageLinkList;
	}

	/**
	 * 创建特定替代关系(01)
	 * 
	 * @param usageLinkList
	 *            父件与所有子件的UsageLink集合
	 * @param substituteMaster
	 *            特定替代料的Master
	 * @param quantity
	 *            数量单位对象
	 * @throws WTException
	 */
	private static String ceateSubstituteLink(List<WTPartUsageLink> usageLinkList, WTPartMaster substituteMaster,
			SubstituteQuantity quantity) throws WTException {
		String errorMessage = "";
		boolean flag = true;// 判断当前行的数量不存在他所有替换关系中
		// Collections.reverse(usageLinkList);
		usageLinkList = SortUsageLink(usageLinkList);
		Iterator<WTPartUsageLink> usageLinkListIte = usageLinkList.iterator();
		while (usageLinkListIte.hasNext()) {
			WTPartUsageLink usageLink = usageLinkListIte.next();
			// 返回的是一个特定替代关系集合
			WTCollection wtcol = WTPartHelper.service.getSubstituteLinks(usageLink);
			WTPartSubstituteLink wtSubstituteLink = getSubstituteLink(substituteMaster, wtcol);
			if (wtSubstituteLink != null) {
				errorMessage = "已存在替代料" + substituteMaster.getNumber();
				// if (quantity.getAmount().equals(wtSubstituteLink.getQuantity().getAmount()))
				// {
				flag = false;
				// }
			}
		}

		Iterator<WTPartUsageLink> usageLinkListIteOther = usageLinkList.iterator();
		if (flag) {
			while (usageLinkListIteOther.hasNext()) {
				WTPartUsageLink usageLink = usageLinkListIteOther.next();
				if (usageLink != null) {
					boolean isExit = ceateSubstituteLink(usageLink, substituteMaster, quantity);// false:存在
					if (isExit) {
						break;
					}
				}
			}
		}
		return errorMessage;
	}

	/**
	 * 创建特定替代关系(02)
	 * 
	 * @param usageLink
	 * @param substituteMaster
	 * @param quantity
	 */
	private static boolean ceateSubstituteLink(WTPartUsageLink usageLink, WTPartMaster substituteMaster,
			SubstituteQuantity quantity) {
		boolean isExit = false;
		if (usageLink != null && substituteMaster != null) {
			try {
				// 返回的是一个特定替代关系集合
				WTCollection wtcol = WTPartHelper.service.getSubstituteLinks(usageLink);
				if (!hasSubstituteLink(substituteMaster, wtcol)) {
					createSubstituteLink(quantity, usageLink, substituteMaster);
					isExit = true;
				}
			} catch (WTException e) {
				e.printStackTrace();
			}
		}
		return isExit;
	}

	/**
	 * 判断是否需要创建WTPartSubstituteLink （true为不用 false表示需要）
	 * 
	 * @param substituteMaster
	 * @param wtcol
	 * @return
	 */
	private static WTPartSubstituteLink getSubstituteLink(WTPartMaster substituteMaster, WTCollection wtcol) {
		// boolean hasSubstituteLink = false;
		WTPartSubstituteLink wtSubstituteLink = null;
		if (wtcol == null) {
			return wtSubstituteLink;
		}
		Iterator wtcolIterator = wtcol.iterator();
		while (wtcolIterator.hasNext()) {
			Object object = wtcolIterator.next();

			if (object != null && object instanceof ObjectReference) {
				ObjectReference orf = (ObjectReference) object;
				Object obj = orf.getObject();

				if (obj != null && obj instanceof WTPartSubstituteLink) {
					wtSubstituteLink = (WTPartSubstituteLink) obj;
				}
			} else if (object != null && object instanceof WTPartSubstituteLink) {
				wtSubstituteLink = (WTPartSubstituteLink) object;
			}
			if (wtSubstituteLink != null) {
				WTPartMaster subMaster = wtSubstituteLink.getSubstitutes();

				boolean hasSubstituteLink = PersistenceHelper.isEquivalent(subMaster, substituteMaster);
				if (hasSubstituteLink) {
					return wtSubstituteLink;
				}
			}
		}
		return null;
	}

	/**
	 * 判断是否需要创建WTPartSubstituteLink （true为不用 false表示需要）
	 * 
	 * @param substituteMaster
	 * @param wtcol
	 * @return
	 */
	private static boolean hasSubstituteLink(WTPartMaster substituteMaster, WTCollection wtcol) {
		boolean hasSubstituteLink = false;
		if (wtcol == null) {
			return hasSubstituteLink;
		}
		Iterator wtcolIterator = wtcol.iterator();

		WTPartSubstituteLink wtSubstituteLink = null;

		while (wtcolIterator.hasNext()) {
			Object object = wtcolIterator.next();

			if (object != null && object instanceof ObjectReference) {
				ObjectReference orf = (ObjectReference) object;
				Object obj = orf.getObject();

				if (obj != null && obj instanceof WTPartSubstituteLink) {
					wtSubstituteLink = (WTPartSubstituteLink) obj;
				}
			} else if (object != null && object instanceof WTPartSubstituteLink) {
				wtSubstituteLink = (WTPartSubstituteLink) object;
			}

			if (wtSubstituteLink != null) {
				WTPartMaster subMaster = wtSubstituteLink.getSubstitutes();

				hasSubstituteLink = PersistenceHelper.isEquivalent(subMaster, substituteMaster);
				if (hasSubstituteLink) {
					break;
				}
			}
		}

		return hasSubstituteLink;
	}

	/**
	 * 创建WTPartSubstituteLink对象
	 * 
	 * @param quantity
	 * @param usageLink
	 * @param substituteMaster
	 */
	private static void createSubstituteLink(SubstituteQuantity quantity, WTPartUsageLink usageLink,
			WTPartMaster substituteMaster) {
		if (usageLink == null || substituteMaster == null) {
			return;
		}
		try {
			// 创建WTPartSubstituteLink
			WTPartSubstituteLink wtSubstituteLink = WTPartSubstituteLink.newWTPartSubstituteLink(usageLink,
					substituteMaster);
			setQuantity(wtSubstituteLink, quantity);
			wtSubstituteLink = (WTPartSubstituteLink) PersistenceHelper.manager.store(wtSubstituteLink);
		} catch (WTException e) {
			e.printStackTrace();
		}

	}

	/**
	 * 设置单位数量
	 * 
	 * @param wtSubstituteLink
	 * @param quantity
	 */
	private static void setQuantity(WTPartSubstituteLink wtSubstituteLink, SubstituteQuantity quantity) {
		if (wtSubstituteLink == null || quantity == null || quantity.equals("")) {
			return;
		}

		wtSubstituteLink.setQuantity(quantity);
	}

	/**
	 * 获取其父件与子件所有的usageLink关系
	 * 
	 * @param parentPart
	 * @param childPartMaster
	 * @return
	 */
	private static List<WTPartUsageLink> getWTPartUsageLink(WTPart parentPart, WTPartMaster childPartMaster) {
		List<WTPartUsageLink> usageLinkList = new ArrayList<WTPartUsageLink>();

		if (parentPart != null && childPartMaster != null) {
			try {
				List<WTPartUsageLink> allUsageLinkList = MyPartUtil.getFirstLevelUsageLink(parentPart);

				Iterator<WTPartUsageLink> allLinkIterator = allUsageLinkList.iterator();
				while (allLinkIterator.hasNext()) {
					WTPartUsageLink partUsageLink = allLinkIterator.next();
					WTPartMaster master = partUsageLink.getUses();

					if (PersistenceHelper.isEquivalent(master, childPartMaster)) {
						usageLinkList.add(partUsageLink);
					}
				}
			} catch (ConfigException e) {
				e.printStackTrace();
			} catch (WTException e) {
				e.printStackTrace();
			}

		}

		return usageLinkList;
	}

	/**
	 * 获取excel中的表头
	 * 
	 * @param sheet
	 * @return
	 * 
	 */
	private static Map<Integer, String> getHeader(Sheet sheet) {
		Map<Integer, String> headerMap = new HashMap<Integer, String>();

		Row row = sheet.getRow(ImportConstants.BOM_HEADER_ROW_INDEX);

		if (row != null) {
			Iterator<Cell> iterator = row.cellIterator();
			while (iterator.hasNext()) {
				Cell cell = iterator.next();

				String header = ImportedExcelUtil.getCellValueAsString(cell).trim();
				Integer columnIndex = cell.getColumnIndex();
				if (!header.equals("")) {
					headerMap.put(columnIndex, header);
				}
			}
		}

		return headerMap;
	}

	/**
	 * 根据视图,编号,版本(指定大版本)获取相应对象
	 * 
	 * @param parentNumber
	 * @param parentView
	 * @param parentVersion
	 * @return
	 */
	private static WTPart getParentPart(String parentNumber, String parentView, String parentVersion) {
		WTPart parentPart = null;
		try {

			if (!parentVersion.equals("")) {
				parentPart = MyPartUtil.getWTPartByNumViewAndVersion(parentNumber, parentView, parentVersion);
				if (parentPart == null) {
					parentPart = CoreUtil.getWTPartByNumberAndView(parentNumber, parentView);
				}

			} else if (parentVersion.equals("")) {
				parentPart = CoreUtil.getWTPartByNumberAndView(parentNumber, parentView);
			}

		} catch (WTException e) {
			e.printStackTrace();
		}

		return parentPart;
	}

	/**
	 * get WTPartSubstituteLink
	 * 
	 * @author xin_gao
	 * @param usageLink
	 * @param substitutePartMaster
	 * @return
	 * @throws WTException
	 */
	public static WTPartSubstituteLink getPartSubstituteLink(WTPartUsageLink usageLink,
			WTPartMaster substitutePartMaster) throws WTException {
		if (usageLink == null || substitutePartMaster == null) {
			return null;
		}
		Long long1 = Long.valueOf(PersistenceHelper.getObjectIdentifier(usageLink).getId());
		Long long2 = Long.valueOf(PersistenceHelper.getObjectIdentifier(substitutePartMaster).getId());
		QuerySpec qs1 = new QuerySpec(WTPartSubstituteLink.class);
		qs1.appendWhere(new wt.query.SearchCondition(WTPartSubstituteLink.class, "roleAObjectRef.key.id", "=", long1),
				new int[] { 0 });
		qs1.appendAnd();
		qs1.appendWhere(new wt.query.SearchCondition(WTPartSubstituteLink.class, "roleBObjectRef.key.id", "=", long2),
				new int[] { 0 });
		QueryResult qr = PersistenceServerHelper.manager.query(qs1);
		if (qr.hasMoreElements()) {
			return (WTPartSubstituteLink) qr.nextElement();
		}
		return null;
	}

	public static void main(String[] args) {

		String str = "0.111111";

		double strToDouble = Double.parseDouble(str);
		System.out.println("strToDouble===>>>" + strToDouble);

		String regEx = "[+]{0,1}(\\d+)$|^[+]{0,1}(\\d+\\.\\d+)$";
		boolean rs = str.matches(regEx);
		System.out.println(rs);
		// if (args == null || args.length != 1) {
		// System.out.println("Debug 参数列表...");
		// return;
		// }
		//
		// if (!RemoteMethodServer.ServerFlag) {
		// String method = "importSubstituteLink";
		//
		// try {
		// System.out.println("Debug RemoteMethodServer...");
		// RemoteMethodServer.getDefault().invoke(method, CLASSNAME, null, new Class[] {
		// String.class },
		// new Object[] { args[0] });
		// System.out.println("Debug end RemoteMethodServer...");
		// } catch (RemoteException e) {
		// e.printStackTrace();
		// } catch (InvocationTargetException e) {
		// e.printStackTrace();
		// }
		//
		// } else {
		// System.out.println("Debug importBoms...");
		// importSubstituteLink(args[0]);
		// System.out.println("Debug end importBoms...");
		// }
	}

}
